n=8765; pencil=[|8509,8699| 8509,4527| 8771,8473|];